<template>
  <el-card class="table-card">
    <h3 slot="header">单据详情</h3>
    <SkusTable
      :defaultMinWidth="95"
      :table-height="500"
      :data-source="tableInfo.list"
      :loading="tableInfo.loading"
      :columns="VIEW_TABLE_COLUMNS"
    />
  </el-card>
</template>
<script>
import SkusTable from '@/components/skusTable';
import { queryAuditRecordDetailService } from '@api/supplier/contract/audit';
import { VIEW_TABLE_COLUMNS } from './constants';

export default {
  components: {
    SkusTable,
  },
  data () {
    return {
      VIEW_TABLE_COLUMNS,
      tableInfo: {
        list: [],
        loading: false,
      }
    };
  },
  created () {
    const { todoId } = this.$route.query;
    this.getTableData(todoId);
  },
  methods: {
    // 获取表格数据
    async getTableData (todoId) {
      const res = await queryAuditRecordDetailService(
        { todoId },
        state => { this.tableInfo.loading = state }
      )
      if (res) {
        const { result } = res;
        this.tableInfo.list = result;
      }
    }
  }
};
</script>
